package com.li.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.TextView;

import com.ndboo.reslibrary.R;

/**
 * Author: Li
 * Date: 2017/10/9 0009
 * Description:
 */

public class PersonalDetailItem extends FrameLayout {
    public TextView getTxtRight() {
        return mTxtRight;
    }

    private TextView mTxtRight;
    private TextView mTxtLeft;
    public PersonalDetailItem(@NonNull Context context) {
        this(context,null);
    }

    public PersonalDetailItem(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        View view= LayoutInflater.from(context).inflate(R.layout.layout_personal_detail,this);
        mTxtRight=view.findViewById(R.id.txt_right);
        mTxtLeft=view.findViewById(R.id.txt_left);

        TypedArray array=context.obtainStyledAttributes(attrs,R.styleable.PersonalDetailItem);

        String txt=array.getString(R.styleable.PersonalDetailItem_pd_txt_left);
        String txtRight=array.getString(R.styleable.PersonalDetailItem_pd_txt_right);
        String txtRightHint=array.getString(R.styleable.PersonalDetailItem_pd_txt_right_hint);

        array.recycle();

        mTxtRight.setHint(txtRightHint);
        setTxtLeft(txt);
        setTxtRight(txtRight);
    }

    public void setTxtLeft(String content){
        mTxtLeft.setText(content);
    }
    public void setTxtRight(String content){
        mTxtRight.setText(content);
    }
    public String getTxtRightContent(){
        return mTxtRight.getText().toString();
    }
}
